(C) 1996 AROS - The Amiga Replacement OS
#include#include #undef AROS_LH1 #undef DateToStr #undef AROS_LHA #define AROS_LH1(ret,name,arg,type,base,offset,libname) \ ret name (arg) #define AROS_LHA(type,name,reg) type name #include #include #include int main (int argc, char ** argv) { struct DateTime curr; char day[LEN_DATSTRING]; char time[LEN_DATSTRING]; char date[LEN_DATSTRING]; DateStamp (&curr.dat_Stamp); curr.dat_Format = FORMAT_DOS; curr.dat_Flags = 0; curr.dat_StrDay = day; curr.dat_StrDate = date; curr.dat_StrTime = time; DateToStr (&curr); printf ("Today is %s, %s. It's %s\n" , day , date , time ); curr.dat_Format = FORMAT_DEF; DateToStr (&curr); printf ("Local date: %s\n", date); curr.dat_Flags = DTF_SUBST; DateToStr (&curr); printf ("Date with DTF_SUBST: %s\n", date); curr.dat_Stamp.ds_Days ++; DateToStr (&curr); printf ("Date +1 with DTF_SUBST: %s\n", date); curr.dat_Stamp.ds_Days ++; DateToStr (&curr); printf ("Date +2 with DTF_SUBST: %s\n", date); curr.dat_Stamp.ds_Days ++; DateToStr (&curr); printf ("Date +3 with DTF_SUBST: %s\n", date); curr.dat_Stamp.ds_Days -= 4; DateToStr (&curr); printf ("Date -1 with DTF_SUBST: %s\n", date); curr.dat_Stamp.ds_Days --; DateToStr (&curr); printf ("Date -2 with DTF_SUBST: %s\n", date); curr.dat_Stamp.ds_Days --; DateToStr (&curr); printf ("Date -3 with DTF_SUBST: %s\n", date); curr.dat_Stamp.ds_Days = 0; curr.dat_Stamp.ds_Minute = 0; curr.dat_Stamp.ds_Tick = 0; DateToStr (&curr); printf ("First Date: %s, %s. Time: %s\n", day, date, time); curr.dat_Stamp.ds_Days = 0; curr.dat_Stamp.ds_Minute = 1; curr.dat_Stamp.ds_Tick = 0; DateToStr (&curr); printf ("First Date + 1 Minute: %s, %s. Time: %s\n", day, date, time); curr.dat_Stamp.ds_Days = 0; curr.dat_Stamp.ds_Minute = 0; curr.dat_Stamp.ds_Tick = 153; DateToStr (&curr); printf ("First Date + 153 Ticks: %s, %s. Time: %s\n", day, date, time); curr.dat_Stamp.ds_Days = 1; curr.dat_Stamp.ds_Minute = 0; curr.dat_Stamp.ds_Tick = 0; DateToStr (&curr); printf ("First Date: %s, %s. Time: %s\n", day, date, time); return 0; } /* main */
Added test code
Added docs
Added missing functionality
AROS uses 4 chars for the date (ie. 2001) but does also accept 97 for 1997.
Moved #include's into first column
The #includes in the header *must* begin in the first column. Otherwise makedepend will ignore them (GCC works, though).
Removed a couple of Logs